import request from '@/utils/request'

// 获取待办任务
export function getTodoTasks(query) {
  return request({
    url: '/workflow/approval/todo',
    method: 'get',
    params: query
  })
}

// 获取已办任务
export function getDoneTasks(query) {
  return request({
    url: '/workflow/approval/done',
    method: 'get',
    params: query
  })
}

// 审批任务
export function approveTask(data) {
  return request({
    url: '/workflow/approval/approve',
    method: 'post',
    data: data
  })
}

// 获取审批记录
export function getApprovalRecords(query) {
  return request({
    url: '/workflow/approval/records',
    method: 'get',
    params: query
  })
}

// 获取流程图
export function getProcessDiagram(processInstanceId) {
  return request({
    url: '/workflow/approval/diagram',
    method: 'get',
    params: { processInstanceId }
  })
}

// 获取任务详情
export function getTaskDetail(taskId) {
  return request({
    url: '/workflow/approval/task/' + taskId,
    method: 'get'
  })
}